<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>KeyHistory</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<link href="../static/theme.css" rel="stylesheet" type="text/css" />
<script src="../static/content.js" type="text/javascript"></script>
</head>
<body>

<h1>KeyHistory</h1>

<p>Displays script info and a history of the most recent keystrokes and mouse clicks.</p>

<pre class="Syntax">KeyHistory</pre>
<h3>Remarks</h3>
<p>This command is equivalent to selecting the &quot;View-&gt;Key history&quot; menu item in the main window.</p>
<p>To disable key history, specify the following line anywhere in the script:</p>
  <pre><a href="_KeyHistory.htm">#KeyHistory</a> 0</pre>
<p><a href="_KeyHistory.htm">#KeyHistory</a> can also be used to change the maximum number of events that will be displayed.</p>
<p>This feature is intended to help <a href="../Scripts.htm#debug">debug scripts and hotkeys</a>. It can also be used to detect the scan code of a non-standard keyboard key using the steps described at the bottom of the <a href="../KeyList.htm#SpecialKeys">key list</a> page (knowing the scan code allows such a key to be made into a hotkey).</p>
<p>The virtual key (VK) of the wheel events (WheelDown, WheelUp, WheelLeft, and WheelRight) are placeholder values that do not have any meaning outside of AutoHotkey. Also, the scan code for wheel events is actually the number of notches by which the wheel was turned (typically 1).</p>
<p>If the script does not have the <a href="_InstallKeybdHook.htm">keyboard hook</a> installed, the KeyHistory window will display only the keyboard events generated by the script itself (i.e. not the user's).  If the script does not have the  <a href="_InstallMouseHook.htm">mouse hook</a> installed, mouse button events will not be shown. You can find out if your script uses either hook via &quot;View-&gt;Key History&quot; in the script's main window (accessible via &quot;Open&quot; in the tray icon). You can force the hooks to be installed by adding either or both of the following lines to the script:</p>
<pre><a href="_InstallKeybdHook.htm">#InstallKeybdHook</a>
<a href="_InstallMouseHook.htm">#InstallMouseHook</a></pre>
<h3>Related</h3>
<p><a href="_KeyHistory.htm">#KeyHistory</a>, <a href="_InstallKeybdHook.htm">#InstallKeybdHook</a>, <a href="_InstallMouseHook.htm">#InstallMouseHook</a>, <a href="ListHotkeys.htm">ListHotkeys</a>, <a href="ListLines.htm">ListLines</a>, <a href="ListVars.htm">ListVars</a>, <a href="GetKeyState.htm">GetKeyState</a>, <a href="KeyWait.htm">KeyWait</a>, <a href="../Variables.htm#PriorKey">A_PriorKey</a></p>
<h3>Examples</h3>
<pre class="NoIndent">KeyHistory <em>; Display the history info in a window.</em></pre>

</body>
</html>
